<extend name="Layout:layout_list" />
<block name="body_content_block">
    <table id="main_grid" class="easyui-datagrid" data-url="{:AddonU('Trunk/get_trunk_list_json')}"></table>
    <div id="tb" style="padding:2px 5px;">
        <div style="margin-bottom: 5px; border-bottom:solid 1px #dddddd;">
            <a href="{:AddonU('Trunk/item_edit')}" class="easyui-linkbutton lnk_grid_add" iconCls="icon-add" plain="true">新增</a>
            <a href="{:AddonU('Trunk/item_edit','id=varid')}" class="easyui-linkbutton lnk_grid_edit" iconCls="icon-edit" plain="true">编辑</a>
            <a href="{:AddonU('Trunk/item_delete','id=varid')}" class="easyui-linkbutton lnk_grid_remove" iconCls="icon-remove" plain="true"  data-success-fn="show_reload_tip">删除</a>
            <a href="{:AddonU('Trunk/trunk_export')}" class="easyui-linkbutton" iconCls="icon-save" plain="true">导出</a>
            <a href="#" class="easyui-linkbutton lnk_grid_search" iconCls="icon-search" plain="true">搜索</a>
        </div>
    </div>
    <!--隐藏区域-->
    <div style="display:none">
        <!--表格查询对话框-->
        <div id="dlg_search" style="padding:10px">
            <form method="get" action="{:AddonU('Trunk/get_trunk_list_json')}" data-export-url="{:AddonU('Trunk/trunk_export')}">
                服务器：<input type="text" name="host" class="easyui-textbox" />
                <if condition="$isSuperAdmin">
                    租户：<input type="text" name="siteID" id="siteID" class="easyui-combobox" data-url="{:AddonU('Admin/get_admin_json')}" />
                    <else/>
                    <input type="hidden" name="siteID" value="{$loginData.siteID}"/>
                </if>
            </form>
        </div>
        <!--/表格查询对话框-->
    </div>
    <!--/隐藏区域-->
</block>
<block name="body_after_block">
    <script type="text/javascript">
        // 页面初始化
        var curd_grid = CurdGrid.newInstance();
        curd_grid.before_search_dialog = function () {
            $('#siteID').combobox({url: $('#siteID').data('url'), valueField: 'id', textField: 'text'});
        }
        curd_grid.config({
            title: '中继管理',
            toolbar: '#tb',
            columns: [[
                    {field: 'ck', checkbox: true},
                    {title: "租户ID", field: "siteIDText", sortable: true},
                    {title: "服务器", field: "host", sortable: true},
                    {title: "端口号", field: "port", sortable: true},
                    {title: "认证用户", field: "username", sortable: true},
                    {title: "中继名称", field: "account", sortable: true},
                    {title: "注册模式", field: "regModeText", sortable: true},
                    {title: "最大通道数", field: "regNumber", sortable: true},
                    {title: "创建时间", field: "createdTime", sortable: true},
                    {title: "编号", field: "id", hidden: true},
                ]],
            rowStyler: function (index, row) {
                if (row.payTypeText == '后付费') {
                    return 'background-color:#FFDDAA;';
                }
            }
        });
        curd_grid.init();
    </script>
</block>